import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);
    public static void main(String[] args) {
        Solution solution = new Solution();
        String[] s1 = new String[10];
        String[] s2 = new String[10];

        String[] s3 = solution.spellchecker(s1,s2);
        for (int i = 0; i < s3.length; i++) {
            System.out.println(s3[i]);
        }
    }

    public static void main1(String[] args) {
        Solution1 solution1 = new Solution1();
        int n = scanner.nextInt();
        int[] array = new int[n];
        System.out.println(solution1.maxFrequencyElements(array));
    }
}

class Solution {
    public String[] spellchecker(String[] wordlist, String[] queries) {
        int n = wordlist.length;
        Set<String> origin = new HashSet<>(Arrays.asList(wordlist));
        Map<String, String> lowerToOrigin = new HashMap<>(n, 1); // 预分配空间
        Map<String, String> vowelToOrigin = new HashMap<>(n, 1);

        for (int i = n - 1; i >= 0; i--) {
            String s = wordlist[i];
            String lower = s.toLowerCase();
            lowerToOrigin.put(lower, s); // 例如 kite -> KiTe
            vowelToOrigin.put(replaceVowels(lower), s); // 例如 k?t? -> KiTe
        }

        for (int i = 0; i < queries.length; i++) {
            String q = queries[i];
            if (origin.contains(q)) { // 完全匹配
                continue;
            }
            String lower = q.toLowerCase();
            if (lowerToOrigin.containsKey(lower)) { // 不区分大小写的匹配
                queries[i] = lowerToOrigin.get(lower);
            } else { // 不区分大小写+元音模糊匹配
                queries[i] = vowelToOrigin.getOrDefault(replaceVowels(lower), "");
            }
        }
        return queries;
    }

    private String replaceVowels(String str) {
        char[] s = str.toCharArray();
        for (int i = 0; i < s.length; ++i) {
            char c = s[i];
            if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
                s[i] = '?';
            }
        }
        return new String(s);
    }
}


class Solution1 {
    public int maxFrequencyElements(int[] nums) {
        Arrays.sort(nums);
        int n = nums[nums.length - 1];
        int[] arr = new int[n + 1];
        for (int i = 0; i < nums.length; i++) {
            arr[nums[i]]++;
        }

        Arrays.sort(arr);
        int max = arr[arr.length - 1];
        int res = 0;
        for(int x : arr){
            if(x==max){
                res+=max;
            }
        }
        return res;
    }
}